-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to demographics.py
for changes in UN API
#936
Conversation
To be resolved:
|
One idea is to include: global UN_TOKEN
# Check for a file named "un_api_token.txt" in the current directory
if os.path.exists(os.path.join("un_api_token.txt")):
with open(os.path.join("un_api_token.txt"), "r") as file:
UN_TOKEN = file.read().strip()
else: # if file not exist, prompt user for token
UN_TOKEN = input("Please enter your UN API token: ") in Would there be any security concerns with this? e.g., a user's token saved on a device that isn't theirs? To solve that, we can have a separate prompt, for "save token to disk" and only write to disk if yes... |
For the ability to use cached files and change the start/end year, we need to save the year as a variables to the output files ( |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #936 +/- ##
==========================================
- Coverage 72.44% 71.92% -0.52%
==========================================
Files 19 19
Lines 4696 4716 +20
==========================================
- Hits 3402 3392 -10
- Misses 1294 1324 +30
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This PR now handles UN data access in the following way:
@rickecon @SeaCelo, let me know if the changes in |
@jdebacker This is a sensible approach. I'll test it and see if there are any issues |
@jdebacker. This looks great. Merging as soon as tests pass. I just committed one extra change at the end of |
This PR updates the
demographics.py
module for updates in the UN WPP data portal API, which now requires users to authenticate with an API token.The PR:
demographics.py
#935)demographics.py
look for a file namedun_api_token.txt
in the current directory, and if not there, prompts the user to enter their API token in the command line (Issue Updatedemographics.py
to use the new UN API format #931).